package com.happycat.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.happycat.Pagination;
import com.happycat.ResponseHeaderModel;
import com.happycat.ResponseModel;
import com.happycat.mobile.model.UserActiveMessaging;
import com.happycat.mobile.service.UserActiveMessagingService;
import com.happycat.utils.ResponseModelUtils;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author liaoyong
 * @since 2020-08-01
 */
@RestController
@RequestMapping("/userActiveMessaging")
@Api(value = "用户动态消息", description = "用户动态消息接口")
public class UserActiveMessagingController {
	@Autowired
	private UserActiveMessagingService userActiveMessagingService;

	@ApiOperation(value = "用户动态消息详情")
	@RequestMapping(method = RequestMethod.POST, value = "/detail")
	public ResponseModel<UserActiveMessaging> detail(@RequestBody UserActiveMessaging userActiveMessaging) {
		return userActiveMessagingService.selectOne(userActiveMessaging);
	}

	@RequestMapping(method = RequestMethod.POST, value = "/page")
	@ApiOperation(value = "用户动态消息分页列表")
	public ResponseModel<Page<UserActiveMessaging>> Page(@RequestBody Pagination<UserActiveMessaging> page) {
		return userActiveMessagingService.pageList(page);
	}

	@RequestMapping(method = RequestMethod.POST, value = "/commentPage")
	@ApiOperation(value = "用户动态消息评论分页列表，此接口必传parent_id")
	public ResponseModel<Page<UserActiveMessaging>> conmentPage(@RequestBody Pagination<UserActiveMessaging> page) {
		return ResponseModelUtils.success("查询成功", userActiveMessagingService.page(page));
	}

	@RequestMapping(method = RequestMethod.POST, value = "/add")
	@ApiOperation(value = "用户动态消息新增")
	public ResponseHeaderModel add(@RequestBody UserActiveMessaging userActiveMessaging) {

		return userActiveMessagingService.add(userActiveMessaging);
	}

	@RequestMapping(method = RequestMethod.POST, value = "/cancleLike")
	@ApiOperation(value = "用户动态消息取消点赞")
	public ResponseHeaderModel cancleLike(@RequestBody UserActiveMessaging userActiveMessaging) {

		return userActiveMessagingService.cancleLike(userActiveMessaging);
	}

	@ApiOperation(value = "用户动态消息编辑")
	@RequestMapping(method = RequestMethod.POST, value = "/modify")
	public ResponseHeaderModel modify(@RequestBody UserActiveMessaging userActiveMessaging) {

		return userActiveMessagingService.modify(userActiveMessaging);
	}

}
